import request from '@/utils/request';

// 商品列表 - 商家端
export async function getGoodsList(params: any) {
  return request('/api/platform/goodsList', {
    method: 'GET',
    params,
  });
}

// 获取商品成色列表
export async function getGoodFineness() {
  return request('/api/platform/getGoodFineness', {
    method: 'GET',
  });
}

// 获取商品租赁规则
export async function getRentPlan() {
  return request('/api/platform/getRentPlan', {
    method: 'GET',
  });
}

// 获取商品分类
export async function getGoodsClass() {
  return request('/api/platform/getGoodsClass', {
    method: 'GET',
  });
}

// 商品上下架
export async function postGoodsUpDownShelf(data: any) {
  return request('/api/platform/updateGoodsStatus', {
    method: 'POST',
    data,
  });
}

// 删除商品
export async function deleteGood(data: any) {
  return request('/api/platform/deleteGood', {
    method: 'POST',
    data,
  });
}

// 获取商品特定状态的数量
export async function getGoodStatusCount() {
  return request('/api/platform/getGoodStatusCount', {
    method: 'GET',
  });
}

// 获取规格库存
export async function getSkuStock(params: any) {
  return request('/api/platform/getSkuStock', {
    method: 'GET',
    params,
  });
}

// 更新商品的指定规格库存
export async function updateSkuStock(data: any) {
  return request('/api/platform/updateSkuStock', {
    method: 'POST',
    data,
  });
}

// 获取增值服务列表
export async function getGainSet() {
  return request('/api/platform/getGainSet', {
    method: 'GET',
  });
}

// 获取地址列表
export async function getAddressList(params: { merchant_id: string }) {
  return request('/api/backend/returnAddrSelections', {
    method: 'GET',
    params,
  });
}

// 获取地址列表
export async function saveReturnAddress(data: any) {
  return request('/api/backend/saveReturnAddress', {
    method: 'POST',
    data,
  });
}

// 保存商品信息
export async function saveGood(data: any) {
  return request('/api/platform/saveGood', {
    method: 'POST',
    data,
  });
}

// 保存商品信息并上架
export async function saveAndActiveGoods(data: any) {
  return request('/api/platform/saveAndActiveGoods', {
    method: 'POST',
    data,
  });
}

// 获取商品信息
export async function goodsDetail(data: { id: string }) {
  return request('/api/platform/goodsDetail', {
    method: 'POST',
    data,
  });
}

// 获取商品列表数据 -- 平台端
export async function getPlatformGoodsList(params: any) {
  return request('/api/platform/platformGoodsList', {
    method: 'GET',
    params,
  });
}

// 获取店铺列表
export async function getShopSelections(params: any) {
  return request('/api/platform/getShopSelections', {
    method: 'GET',
    params,
  });
}

// 商品展示/取消展示（支持批量）
export async function updateGoodsDisplayStatus(data: any) {
  return request('/api/platform/updateGoodsDisplayStatus', {
    method: 'POST',
    data,
  });
}

// 【平台端】各个商品列表记录总数
export async function getPlatformGoodsCount() {
  return request('/api/platform/getPlatformGoodsCount', {
    method: 'GET',
  });
}

// 【平台】获取商品业务分类列表
export async function getCategorySelections(params: { cate_name: string,plt:string | number }) {
  return request('/api/platform/getCategorySelections', {
    method: 'GET',
    params,
  });
}

// 【平台】设置商品分类
export async function setGoodsCategory(data: any) {
  return request('/api/platform/setGoodsCategory', {
    method: 'POST',
    data,
  });
}

// 【平台】获取商品库列表
export async function getGoodsForDisplay(params: any) {
  return request('/api/platform/getGoodsForDisplay', {
    method: 'GET',
    params,
  });
}

// 【平台】强制下架原因选项
export async function getForceRefuseReasons() {
  return request('/api/platform/getForceRefuseReasons', {
    method: 'GET',
  });
}

// 【平台】强制下架
export async function forceGoodsDown(data: any) {
  return request('/api/platform/forceGoodsDown', {
    method: 'POST',
    data,
  });
}

//  更新商品排序
export async function updateGoodsSort(data: any) {
  return request('/api/platform/updateGoodsSort', {
    method: 'POST',
    data,
  });
}

// 获取展示渠道搜索列表
export async function getShowPlts(params:any) {
  return request('/api/backend/getShowPlts', {
    method: 'GET',
    params
  });
}

// 获取买卖套餐租期数列表
export async function getTerms(params:any) {
  return request('/api/platform/getTerms', {
    method: 'GET',
    params
  });
}